/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package todotask.Renderer;

import java.awt.Component;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;
import todotask.entities.Category;

/**
 *
 * @author dakota
 */
public class CustomCategoryBox extends JLabel implements ListCellRenderer {

    @Override
    public Component getListCellRendererComponent(JList jlist, Object o, int i, boolean bln, boolean bln1) {
        Category cat = (Category) o;
        ImageIcon icono = new ImageIcon(getClass().getResource("/todotask/images/category.png"));
        setIcon(icono);
        setOpaque(true);
        setBackground(cat.getColor());
        setText(cat.getNombre());
        setSize(74, 26);
        return this;
    }
}
